﻿using System;
using EasyAbp.FileManagement.Containers;
using JetBrains.Annotations;

namespace EasyAbp.FileManagement.Options.Containers
{
    public class FileContainerConfiguration : PublicFileContainerConfiguration
    {
        public string AbpBlobContainerName { get; set; }

        public string AbpBlobDirectorySeparator { get; set; }
        
        /// <summary>
        /// Do not delete the BLOB even if no file is using it.
        /// </summary>
        public bool RetainUnusedBlobs { get; set; }

        [CanBeNull]
        public Type SpecifiedFileDownloadProviderType { get; set; }

        /// <summary>
        /// Assume a file has been uploaded before (even if its name and mime-type is different now).
        /// If you upload it again, the new file will reuse the previous BLOB by default.
        /// This feature helps you avoid unnecessary storage consumption.
        /// Set this option to true if you don't want the BLOB reuse.
        /// </summary>
        public bool DisableBlobReuse { get; set; }
        
        /// <summary>
        /// If this option is set to true, the BLOB name (generated by IFileBlobNameGenerator) should be absolutely unique.
        /// Otherwise the existing BLOB that other files depend on will be overriden.
        /// However, if the following conditions are met, it can also be set to true:
        /// 1. The option DisableBlobReuse is true.
        /// 2. Your blob name (created by IFileBlobNameGenerator) is generated based on the file name.
        /// </summary>
        public bool AllowBlobOverriding { get; set; }
    }
}